<!DOCTYPE html>
<html>
    <body>
        <audio id="sound">
            <source src="audio/click5.ogg" type="audio/ogg">
        </audio>
        <button onclick="play()">play</button>
        <button onclick="pause()">pause</button>
        <button onclick="stop()">stop</button>
        <button onclick="replay(event)">replay</button>
    </body>
    <script>
        const audio = document.getElementById("sound");
        // 播放
        function play() {
            audio.play();
        }
        // 暂停
        function pause() {
            audio.pause();
        }
        // 停止
        function stop() {
            audio.pause();
            audio.currentTime = 0;
        }
        // 重播
        function replay(e) {
            audio.currentTime = 0;
            audio.play();
        }
    </script>
</html>